package com.company.OfferGuide;

import java.util.HashMap;

public class 最长回文串 {

    public static int a = 1;

    public static int longestPalindrome(String s) {
        if (s == null || s.length() == 0) return 0;
        int[] map = new int['z' + 1];

        for (int i = 0; i < s.length(); i++) {
            map[s.charAt(i)] ++;
        }

        int count = 0;
        for (int i = 'A'; i < map.length; i++) {
            if (map[i] % 2 == 1) count++;
        }
        if (count != 0) count--;
        return s.length() - count;
    }

    public static void main(String[] args) {
        System.out.println(longestPalindrome("bb"));
    }

}
